<!-- 水印 -->
<template>
  <div id="container">
    <el-card shadow="never" id="container">
      <template #header>
        <div class="font-medium">
          二维码（基于
          <el-link href="https://www.npmjs.com/package/qrcode.vue"
            >qrcode.vue</el-link
          >
          生成）
        </div>
      </template>
      <el-row :gutter="24">
        <el-col :span="6">
          <el-card style="text-align: center" shadow="never">
            <QrCodeGenerator
              :value="value1"
              :level="level1 as Level"
              :render-as="renderAs1 as RenderAs"
              :background="background1"
              :foreground="foreground1"
              :gradient="gradient1"
              :gradient-type="gradientType1 as GradientType"
              :gradient-start-color="gradientStartColor1"
              :gradient-end-color="gradientEndColor1"
              :image-settings="imageSettings1 as ImageSettings"
            />
          </el-card>
        </el-col>
        <el-col :span="6">
          <el-card style="text-align: center" shadow="never">
            <QrCodeGenerator
              :value="value2"
              :level="level2 as Level"
              :render-as="renderAs2 as RenderAs"
              :background="background2"
              :foreground="foreground2"
              :gradient="gradient2"
              :gradient-type="gradientType2 as GradientType"
              :gradient-start-color="gradientStartColor2"
              :gradient-end-color="gradientEndColor2"
              :image-settings="imageSettings2"
            />
          </el-card>
        </el-col>
        <el-col :span="6">
          <el-card style="text-align: center" shadow="never">
            <QrCodeGenerator
              :value="value3"
              :level="level3 as Level"
              :render-as="renderAs3 as RenderAs"
              :background="background3"
              :foreground="foreground3"
              :gradient="gradient3"
              :gradient-type="gradientType3 as GradientType"
              :gradient-start-color="gradientStartColor3"
              :gradient-end-color="gradientEndColor3"
              :image-settings="imageSettings3"
            />
          </el-card>
        </el-col>
        <el-col :span="6">
          <el-card style="text-align: center" shadow="never">
            <QrCodeGenerator
              :value="value4"
              :level="level4 as Level"
              :render-as="renderAs4 as RenderAs"
              :background="background4"
              :foreground="foreground4"
              :gradient="gradient4"
              :gradient-type="gradientType4"
              :gradient-start-color="gradientStartColor4"
              :gradient-end-color="gradientEndColor4"
              :image-settings="imageSettings4"
            />
          </el-card>
        </el-col>
      </el-row>
      <div style="width: 1500px; text-align: center; margin: 20px 0">
        <el-button @click="router.back()">返回</el-button>
      </div>
    </el-card>
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { useRouter } from "vue-router";
const router = useRouter();
import QrCodeGenerator from "@/components/ReQrcode/index.vue";
import type { Level, RenderAs, GradientType, ImageSettings } from "qrcode.vue";

const value1 = ref("https://www.baidu.com");
const level1 = ref("L");
const renderAs1 = ref("svg");
const background1 = ref("#ffffff");
const foreground1 = ref("#000000");
const gradient1 = ref(false);
const gradientType1 = ref("linear");
const gradientStartColor1 = ref("#000000");
const gradientEndColor1 = ref("#ffffff");
const imageSettings1 = ref({});

const value2 = ref("https://www.csdn.net/");
const level2 = ref("L");
const renderAs2 = ref("svg");
const background2 = ref("#ffffff");
const foreground2 = ref("#000000");
const gradient2 = ref(false);
const gradientType2 = ref("linear");
const gradientStartColor2 = ref("#000000");
const gradientEndColor2 = ref("#ffffff");
const imageSettings2 = ref({
  src: "https://avatars.githubusercontent.com/u/10656202?v=4",
  width: 30,
  height: 30,
  excavate: true,
});

const value3 = ref("https://juejin.cn/");
const level3 = ref("H");
const renderAs3 = ref("canvas");
const background3 = ref("#f0f0f0");
const foreground3 = ref("#ff0000");
const gradient3 = ref(true);
const gradientType3 = ref("radial");
const gradientStartColor3 = ref("#ff0000");
const gradientEndColor3 = ref("#0000ff");
const imageSettings3 = ref({
  src: "",
  width: 0,
  height: 0,
  excavate: false,
});

const value4 = ref("https://www.baidu.com");
const level4 = ref("L");
const renderAs4 = ref("svg");
const background4 = ref("#000000");
const foreground4 = ref("#ffffff");
const gradient4 = ref(false);
const imageSettings4 = ref({
  src: "",
  width: 0,
  height: 0,
  excavate: false,
});
</script>

<style scoped>
#container {
  padding: 20px;
}
</style>
